<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('缺票登记信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>机构号：</p>
                                <input type="text" name="orgCode" onclick="selectDeptTree()"  id="treeId" placeholder="请选择"/>
                            </li>
                            <li>
                                <p>柜员号：</p>
                                <input type="text" name="tellerCode"/>
                            </li>
                            <li>
                                <p>交易流水号：</p>
                                <input type="text" name="vchNo"/>
                            </li>
                            <li class="select-time">
                                <p>交易日期：</p>
                                <input type="text" class="time-input" id="trDate" placeholder="交易日期" name="trDate"/>
                            </li>
                            <li>
                                <p>整改状态：</p>
                                <select name="status" th:with="type=${@dict.getType('lost_voucher_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="paea:paeaLostVoucher:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary multiple disabled" onclick="centerConfirm()" shiro:hasPermission="paea:paeaLostVoucher:centerConfirm">
                    <i class="fa fa-save"></i> 中心确认
                </a>
                <a class="btn btn-danger multiple disabled" onclick="cancel()" shiro:hasPermission="paea:paeaLostVoucher:cancel">
                    <i class="fa fa-close"></i> 取消
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="paea:paeaLostVoucher:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('paea:paeaLostVoucher:edit')}]];
        var removeFlag = [[${@permission.hasPermi('paea:paeaLostVoucher:remove')}]];
        var statusDatas = [[${@dict.getType('lost_voucher_status')}]];
        var limitDatas = [[${@dict.getType('lost_voucher_limit')}]];
        var prefix = ctx + "paea/paeaLostVoucher";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "缺票登记信息",
                //启用跳转至指定页
                showPageGo: true,
                //启用点击选中行
                clickToSelect: true,
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : '主键',
                    visible: false
                },
                {
                    field : 'orgCode', 
                    title : '机构号'
                },
                {
                    field : 'tellerCode', 
                    title : '柜员号'
                },
                {
                    field : 'vchNo', 
                    title : '交易流水号'
                },
                {
                    field : 'trDate', 
                    title : '交易日期'
                },
                {
                    field : 'creator', 
                    title : '登记人'
                },
                {
                    field : 'createDate', 
                    title : '登记日期'
                },
                {
                    field : 'remark', 
                    title : '缺票信息'
                },
                {
                    field : 'status', 
                    title : '整改状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field : 'limit', 
                    title : '补票状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(limitDatas, value);
                    }
                },
                {
                    field : 'limitDate', 
                    title : '整改期限'
                },
                {
                    field : 'updateDate', 
                    title : '维护日期'
                },
                {
                    field : 'smTime', 
                    title : '补扫日期'
                },
                {
                    field : 'wdConfirmDate', 
                    title : '网点确认日期'
                },
                {
                    field : 'zxConfirmDate', 
                    title : '中心确认日期'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function centerConfirm() {
            table.set();
            var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认要确认选中的" + rows.length + "条数据吗?", function() {
                var url = prefix + "/centerConfirm";
                var data = { "ids": rows.join() };
                $.operate.submit(url, "post", "json", data);
            });
        };
        function cancel() {
            table.set();
            var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认要确认选中的" + rows.length + "条数据吗?", function() {
                var url = prefix + "/cancel";
                var data = { "ids": rows.join() };
                $.operate.submit(url, "post", "json", data);
            });
        };
        //选择机构
        function selectDeptTree() {
            var treeId = $("#treeId").val();
            var deptId = $.common.isEmpty(treeId) ? "00038" : $("#treeId").val();
            var url = ctx + "system/dept/selectDeptTree/" + deptId;
            var options = {
                title: '选择部门',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
        function doSubmit(index, layero){
            var tree = layero.find("iframe")[0].contentWindow.$._tree;
            if ($.tree.notAllowParents(tree)) {
                var body = layer.getChildFrame('body', index);
                $("#treeId").val(body.find('#treeId').val());
                layer.close(index);
            }
        }
    </script>
</body>
</html>